package fr.emse.tatiana.replayable.analysis;

import java.util.EventObject;
import java.util.Vector;

import fr.emse.tatiana.replayable.Anchor;

// Declare the event. It must extend EventObject.
public class AnalysisEvent extends EventObject {
	
	public static final int LINK_CHANGE = 0;
	public static final int TITLE_CHANGE = 1;
	public static final int ELEMENT_CHANGE =2;
	public static final int ELEMENT_ADD =3;
	public static final int ELEMENT_REMOVE = 4;
	public static final int POSITION_CHANGE = 5;
	
	private int type;
	private Vector<Anchor> anchors;
	private Object element;
	
    public AnalysisEvent(IAnalysis source) {
        super(source);
        this.type = TITLE_CHANGE;
    }
    
    public AnalysisEvent(IAnalysis source, Anchor anchor) {
    	this(source);
    	anchors = new Vector<Anchor>();
    	anchors.add(anchor);
    	this.type = LINK_CHANGE;
    }
    
    public AnalysisEvent(IAnalysis source, Vector<Anchor> anchors) {
    	super(source);
    	this.anchors = anchors;
    	this.type = ELEMENT_CHANGE;
    }
    
    public AnalysisEvent(IAnalysis source, int type, Object cat) {
		super(source);
		this.type=type;
	}

	public Vector<Anchor> getAnchors() {
    	return anchors;
    }
    
    public int getType() {
    	return type;
    }
    
    public Object getElement() {
    	return element;
    }
    
}